<template>
  <div>
    <button @click="back">返回</button>
    <div v-for="item in list" :key = "item.id">
      <img :src="item.imgUrl" alt="">
    </div>
  </div>
</template>

<script>
// import axios from "axios";
import request from "../utils/request";

export default {
  name: "AxiosVue",
  data() {
    return {
      list:[]
    };
  },
  methods: {
    back() {
      this.$router.back()
    }
  },
  mounted() {
    // 请求数据
    // axios.get("/weChat/applet/course/banner/list?number=5")
    //     .then(res => {
    //       console.log(res)
    //       console.log(res.data.data);
    //       this.list = res.data.data;
    //     })
    // // 常见的请求类型：get、post、put、delete
    // axios.get("")
    // axios.post("",{})
    // axios.put("",{})
    // axios.delete("")
    // axios({
    //   method: "get",
    //   url:"https://showme2.myhope365.com/online_course/weChat/applet/course/banner/list?number=5"
    // }).then(res=>{
    //   console.log(res)
    // })

    // this.$route.query获取路由的参数
    console.log(this.$route.query.name)
    console.log(this.$route.path)

    request.get("/weChat/applet/course/banner/list")
        .then(res=>{
          this.list = res.data.data;
        })
  }

}
</script>

<style scoped>

</style>
